using MongoDB.Driver;

namespace CQRS.Events
{
    public class MongoDatabaseHelper: IMongoDatabaseHelper
    {
        public MongoDatabase GetMongoDatabase()
        {
            const string connectionString = "mongodb://localhost/?safe=true";
            var mgsb = new MongoUrlBuilder(connectionString);
            mgsb.DatabaseName = "DemoCQRSApplication";
            var mongoServer = MongoServer.Create(mgsb.ToMongoUrl());
            return mongoServer.GetDatabase(mgsb.DatabaseName);
        }
    }
}